package cn.bookcycle.order.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

/**
 * 订单ID工具类
 *
 * @author liufenglin
 * @date 2018年4月3日
 */
public class OrderId {
	
	public static final String DATE_FORMAT = "yyyyMMddHHmmss";
	
	/**
	 * 生成32位的订单号
	 * 
	 * @return {@link String}
	 */
	public static String generateOrderId32() {
		String orderId = null;
		String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
		orderId = sdf.format(new Date()) + uuid.substring(DATE_FORMAT.length());
		return orderId;
	}
}
